package org.example.blog.controller;



import org.example.blog.context.BaseContext;
import org.example.blog.service.AiChatService;
import org.springframework.web.bind.annotation.*;
import reactor.core.publisher.Flux;

@RestController

public class AiController {


    private final AiChatService aiChatService;

    public AiController(AiChatService aiChatService) {
        this.aiChatService = aiChatService;
    }



    @RequestMapping(value = "/chat",produces = "text/html;charset=utf-8")
    public Flux<String> chat(@RequestParam String message) {
        long id = BaseContext.getCurrentId();
        return aiChatService.chat(id, message);
    }

}
